package cn.kattomy.shop.user.adminaction;

import java.util.List;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

import cn.kattomy.shop.user.service.UserService;
import cn.kattomy.shop.user.vo.User;

public class AdminUserAction extends ActionSupport implements ModelDriven<User> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	//模型驱动使用的对象
	private User user = new User();
	@Override
	public User getModel() {
		return user;
	}
	
	//注入 UserService 
	private UserService userService;
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	
	/**
	 * 列出所有用户的方法
	 * @return
	 */
	public String findAll(){
		//查询所有的用户集合
		List<User> uList = userService.findAll();
		//放入值栈以供前台页面使用
		ActionContext.getContext().getValueStack().set("uList", uList);
		return "findAll";
	}

}
